package ntancnit.app.network;

import android.content.Context;
import android.net.ConnectivityManager;

public class Config {
	
	public static String SHAREDPREFERENCES_DATA = "ntancnit.app";
	public static final String AD_UNIT_ID = "ca-app-pub-5426665153896839/6867340701";
	
	public static boolean isNetworkAvailable(Context context) {
		boolean available = false;
		try {
			ConnectivityManager conMgr = (ConnectivityManager) context
					.getSystemService(context.CONNECTIVITY_SERVICE);
			// Type conect 3G
			final android.net.NetworkInfo mobile = conMgr
					.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
			// Type conect wifi
			final android.net.NetworkInfo wifi = conMgr
					.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
			if (wifi.isAvailable() && wifi.isConnected()) {
				available = true;
			} else if (mobile.isAvailable() && mobile.isConnected()) {
				available = true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		return available;
	}

}
